<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import {getuser} from '../src/api/login'
import { ref, reactive, onMounted, inject, computed,onBeforeMount } from "vue";

const mychat: any = inject("mychat");
onLaunch(() => {

  // const lanjie = () => {
  //   if (!uni.getStorageSync('storage_key')) {
  //     uni.showToast({
  //       title: "请先登录！",
  //       icon: "error",
  //       duration: 1000,
  //     });
  //     uni.switchTab({
  //       url: "../../pages/my/index",
  //     });
   
  //   }
  // };
  // lanjie();

});
onShow(() => {
  console.log('进入小程序');
  setTimeout(async () => {

    
  mychat.create() 
  mychat.onSocketOpen();
  mychat.onSocketError()
  mychat.onSocketClose()
  
//  const res=await getuser()
//  if(res.data.code==200){

//   mychat.create() 
//   mychat.onSocketOpen();
//   mychat.onSocketError()
//   mychat.onSocketClose()
//  }


  
  }
  
)
});
onHide(() => {
  console.log('隐藏小程序');
  mychat.onSocketCloseyonh()
});
</script>
<style lang="scss">
.uni-tabbar__item {
  font-size: 18px !important;
  /* 设置为你需要的字体大小 */
}

.haobei {
  background: linear-gradient(180deg,
      $uni-primary 0%,
      rgba(216, 237, 232, 0.43) 61.6%,
      rgba(217, 217, 217, 0) 100%);
}

.is-input-border {
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  border-bottom: 1px #eee solid !important;
}
</style>
